{{include file="public/header" /}}

<!-- nav start -->
{{include file="public/nav" /}}
<!-- nav end -->

<!-- header top nav -->
{{include file="public/header_top_nav" /}}

<!-- search -->
{{include file="public/nav_search" /}}

<!-- header nav -->
{{include file="public/header_nav" /}}

<!-- banner -->
{{include file="public/home_banner" /}}

<!-- goods category -->
{{include file="public/goods_category" /}}

<!-- 轮播上内容 -->
<div class="am-container slideall">
    <!-- 轮播-手机导航 -->
    {{if !empty($navigation)}}
        <div class="am-g am-g-fixed small-nav">
            {{foreach $navigation as $nav}}
                <div class="am-u-sm-3">
                    <a {{if $nav['is_need_login'] eq 1 and empty($user)}} href="javascript:;" class="login-event" {{else /}} href="{{$nav.event_value}}" {{/if}} >
                        <div class="nav-icon" style="{{if !empty($nav['bg_color'])}}background:{{$nav.bg_color}};{{/if}}">
                            <img src="{{$nav.images_url}}" alt="{{$nav.name}}" />
                        </div>
                        <div class="mini-nav-title">{{$nav.name}}</div>
                    </a>
                </div>
            {{/foreach}}
        </div>
    {{/if}}

    <!-- 轮播-聚合内容 -->
    <div class="banner-mixed">
        <div class="mod-vip">
            <div class="m-baseinfo">
                <a href="{{if !empty($user)}}{{:MyUrl('index/user/index')}}{{else /}}javascript:;{{/if}}" target="_blank">
                    <img src="{{if !empty($user['avatar'])}}{{$user.avatar}}{{else /}}{{$attachment_host}}/static/{{$module_name}}/{{$default_theme}}/images/default-user-avatar.jpg{{/if}}" class="user-avatar" />
                </a>
                <em>
                    <span class="s-name am-text-truncate">
                        {{if !empty($user)}}
                            <em>Hi,</em>
                            {{if !empty($user['icon'])}}
                                <img src="{{$user.icon}}" class="common-user-icon" {{if !empty($user['icon_title'])}}title="{{$user.icon_title}}"{{/if}} />
                            {{/if}}
                            <em>{{$user.user_name_view}}</em>
                        {{else /}}
                            <em>您好，欢迎来到</em>
                            <em>{{:MyC('home_site_name')}}</em>
                        {{/if}}
                    </span>
                </em>
                {{if !empty($user)}}
                    <a href="{{:MyUrl('index/user/logout')}}" class="member-logout">退出</a>
                {{/if}}
            </div>
            {{if empty($user) and (MyC('home_user_login_state') eq 1 or in_array('sms', MyC('home_user_reg_state')) or in_array('email', MyC('home_user_reg_state')))}}
                <div class="member-login">
                    {{if MyC('home_user_login_state') eq 1}}
                        <a class="am-btn-primary btn am-fl" href="{{:MyUrl('index/user/loginInfo')}}">登录</a>
                    {{/if}}
                    {{if in_array('sms', MyC('home_user_reg_state')) or in_array('email', MyC('home_user_reg_state')) or in_array('username', MyC('home_user_reg_state'))}}
                        <a class="am-btn-primary btn am-fr" href="{{:MyUrl('index/user/regInfo')}}">注册</a>
                    {{/if}}
                </div>
            {{/if}}
            {{if !empty($user)}}
                <div class="member-center">
                    {{if !empty($user_order_status)}}
                        {{foreach $user_order_status as $v}}
                            {{if in_array($v['status'], [1,2,3])}}
                                <a href="{{:MyUrl('index/order/index', ['is_more'=>1, 'status'=>$v['status']])}}" target="_blank"><strong>{{$v.count}}</strong>{{$v.name}}</a>
                            {{elseif in_array($v['status'], [100]) /}}
                                <a href="{{:MyUrl('index/order/index', ['is_more'=>1, 'is_comments'=>0, 'status'=>4])}}" target="_blank"><strong>{{$v.count}}</strong>{{$v.name}}</a>
                            {{/if}}
                        {{/foreach}}
                    {{/if}}
                </div>
            {{/if}}
        </div>
        {{if !empty($article_list)}}
            <div class="banner-news">
                <p class="banner-news-title">新闻头条</p>
                <ul>
                    {{foreach $article_list as $article}}
                        <li>
                            <a href="{{$article.url}}" target="_blank">
                                {{if isset($article['article_category_name'])}}
                                    <span>[{{$article.article_category_name}}]</span>
                                {{/if}}
                                <span {{if !empty($article.title_color)}}style="color:{{$article.title_color}};"{{/if}} >{{$article.title}}</span>
                            </a>
                        </li>
                    {{/foreach}}
                </ul>
            </div>
        {{/if}}

        <!-- 轮播混合数据底部钩子 -->
        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
            <div class="plugins-tag">
                <span>plugins_view_home_banner_mixed_bottom</span>
            </div>
        {{/if}}
        {{if !empty($plugins_view_home_banner_mixed_bottom_data) and is_array($plugins_view_home_banner_mixed_bottom_data)}}
            {{foreach $plugins_view_home_banner_mixed_bottom_data as $hook}}
                {{if is_string($hook) or is_int($hook)}}
                    {{$hook|raw}}
                {{/if}}
            {{/foreach}}
        {{/if}}
    </div>
</div>

<!-- 楼层数据顶部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
    <div class="plugins-tag">
        <span>plugins_view_home_floor_top</span>
    </div>
{{/if}}
{{if !empty($plugins_view_home_floor_top_data) and is_array($plugins_view_home_floor_top_data)}}
    {{foreach $plugins_view_home_floor_top_data as $hook}}
        {{if is_string($hook) or is_int($hook)}}
            {{$hook|raw}}
        {{/if}}
    {{/foreach}}
{{/if}}

<!-- 楼层-主内容 -->
<div class="home-floor">
    <!-- 楼层 -->
    {{if !empty($goods_floor_list)}}
        {{foreach $goods_floor_list as $key=>$floor}}
            <div id="floor{{$key+1}}">
                <div class="am-container">
                    <div class="items-nav-title" {{if !empty($floor['bg_color'])}}style="border-bottom: 2px solid {{$floor.bg_color}};"{{/if}}>
                        <p class="floor-title">{{$floor.name}}</p>
                        <p class="floor-desc">{{$floor.vice_name}}</p>
                        <div class="today-brands ">
                            {{if !empty($floor['items'])}}
                                {{foreach $floor.items as $key=>$category}}
                                    {{if !empty($category['items'])}}
                                        {{foreach $category.items as $keys=>$categorys}}
                                            {{if $key lt 6 and $keys eq 0}}
                                                <a href="{{:MyUrl('index/search/index', ['category_id'=>$categorys['id']])}}" target="_blank">{{$categorys.name}}</a>
                                            {{/if}}
                                        {{/foreach}}
                                    {{/if}}
                                {{/foreach}}
                            {{/if}}
                        </div>
                        <span class="more">
                            <a href="{{:MyUrl('index/search/index', ['category_id'=>$floor['id']])}}" target="_blank">更多 <i class="am-icon-angle-right"></i></a>
                        </span>
                    </div>
                </div>
                
                <div class="am-g am-g-fixed floor">
                    <!-- 首页楼层内部顶部钩子 -->
                    {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                        <div class="plugins-tag">
                            <span>plugins_view_home_floor_inside_top</span>
                        </div>
                    {{/if}}
                    {{php}}
                        $hook_name = 'plugins_view_home_floor_inside_top';
                        $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]);
                        if(!empty($hook_data) && is_array($hook_data))
                        {
                            foreach($hook_data as $hook)
                            {
                                if(is_string($hook) || is_int($hook))
                                {
                                    echo htmlspecialchars_decode($hook);
                                }
                            }
                        }
                    {{/php}}

                    <div class="am-u-sm-3 aggregation" {{if !empty($floor['bg_color'])}}style="background-color:{{$floor.bg_color}};"{{else /}}style="background-color:#eaeaea;"{{/if}}>
                        <div class="word">
                            {{if !empty($floor['items'])}}
                                {{foreach $floor.items as $category_key=>$category}}
                                    {{if $category_key lt 6}}
                                        <a href="{{:MyUrl('index/search/index', ['category_id'=>$category['id']])}}" class="outer" target="_blank">{{:mb_substr($category['name'], 0, 4, 'utf-8')}}</a>
                                    {{/if}}
                                {{/foreach}}
                            {{/if}}           
                        </div>
                        <div class="outer-con">
                            <div class="describe">{{$floor.describe}}</div>
                        </div>
                        {{if !empty($floor['big_images'])}}
                            <a href="{{:MyUrl('index/search/index', ['category_id'=>$floor['id']])}}" target="_blank">
                                <img src="{{$floor.big_images}}" />
                            </a>
                        {{/if}}
                        <div class="triangle-topright"></div>

                        <!-- 首页楼层内部底部钩子 -->
                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                            <div class="plugins-tag">
                                <span>plugins_view_home_aggregation_inside_bottom</span>
                            </div>
                        {{/if}}
                        {{php}}
                            $hook_name = 'plugins_view_home_aggregation_inside_bottom';
                            $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]);
                            if(!empty($hook_data) && is_array($hook_data))
                            {
                                foreach($hook_data as $hook)
                                {
                                    if(is_string($hook) || is_int($hook))
                                    {
                                        echo htmlspecialchars_decode($hook);
                                    }
                                }
                            }
                        {{/php}}
                    </div>

                    <div class="goods-list">
                        {{if !empty($floor['goods'])}}
                            {{foreach $floor.goods as $goods_key=>$goods}}
                                <div class="goods-items">
                                    <a href="{{$goods.goods_url}}" target="_blank" class="am-block am-text-center">
                                        <!-- 首页楼层商品内部顶部钩子 -->
                                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                                            <div class="plugins-tag">
                                                <span>plugins_view_home_goods_inside_top</span>
                                            </div>
                                        {{/if}}
                                        {{php}}
                                            $hook_name = 'plugins_view_home_goods_inside_top';
                                            $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]);
                                            if(!empty($hook_data) && is_array($hook_data))
                                            {
                                                foreach($hook_data as $hook)
                                                {
                                                    if(is_string($hook) || is_int($hook))
                                                    {
                                                        echo htmlspecialchars_decode($hook);
                                                    }
                                                }
                                            }
                                        {{/php}}
                                        <img src="{{$goods.images}}" alt="{{$goods.title}}" class="goods-images" />
                                    </a>
                                    <div class="outer-con">
                                        <div class="goods-title am-text-truncate-2 am-margin-bottom-xs">
                                            <a href="{{$goods['goods_url']}}" target="_blank" {{if !empty($goods.title_color)}}style="color:{{$goods.title_color}};"{{/if}}>{{$goods.title}}</a>
                                        </div>

                                        <!-- 首页楼层商品售价顶部钩子 -->
                                        {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                                            <div class="plugins-tag">
                                                <span>plugins_view_home_goods_inside_price_top</span>
                                            </div>
                                        {{/if}}
                                        {{php}}
                                            $hook_name = 'plugins_view_home_goods_inside_price_top';
                                            $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]);
                                            if(!empty($hook_data) && is_array($hook_data))
                                            {
                                                foreach($hook_data as $hook)
                                                {
                                                    if(is_string($hook) || is_int($hook))
                                                    {
                                                        echo htmlspecialchars_decode($hook);
                                                    }
                                                }
                                            }
                                        {{/php}}
                                        <p class="price am-text-truncate">{{$price_symbol}}{{$goods.price}}</p>
                                    </div>

                                    <!-- 首页楼层商品内部底部钩子 -->
                                    {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                                        <div class="plugins-tag">
                                            <span>plugins_view_home_goods_inside_bottom</span>
                                        </div>
                                    {{/if}}
                                    {{php}}
                                        $hook_name = 'plugins_view_home_goods_inside_bottom';
                                        $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'goods_id'=>$goods['id'], 'goods'=>$goods]);
                                        if(!empty($hook_data) && is_array($hook_data))
                                        {
                                            foreach($hook_data as $hook)
                                            {
                                                if(is_string($hook) || is_int($hook))
                                                {
                                                    echo htmlspecialchars_decode($hook);
                                                }
                                            }
                                        }
                                    {{/php}}
                                </div>
                            {{/foreach}}
                        {{/if}}
                    </div>

                    <!-- 首页楼层内部底部钩子 -->
                    {{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
                        <div class="plugins-tag">
                            <span>plugins_view_home_floor_inside_bottom</span>
                        </div>
                    {{/if}}
                    {{php}}
                        $hook_name = 'plugins_view_home_floor_inside_bottom';
                        $hook_data = Hook::listen($hook_name, ['hook_name'=>$hook_name, 'is_backend'=>false, 'floor_id'=>$key+1, 'floor'=>$floor]);
                        if(!empty($hook_data) && is_array($hook_data))
                        {
                            foreach($hook_data as $hook)
                            {
                                if(is_string($hook) || is_int($hook))
                                {
                                    echo htmlspecialchars_decode($hook);
                                }
                            }
                        }
                    {{/php}}
                </div>
            </div>
        {{/foreach}}
    {{/if}}
</div>

<!-- 楼层数据底部钩子 -->
{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true and (!isset($is_footer) or $is_footer eq 1)}}
    <div class="plugins-tag">
        <span>plugins_view_home_floor_bottom</span>
    </div>
{{/if}}
{{if !empty($plugins_view_home_floor_bottom_data) and is_array($plugins_view_home_floor_bottom_data)}}
    {{foreach $plugins_view_home_floor_bottom_data as $hook}}
        {{if is_string($hook) or is_int($hook)}}
            {{$hook|raw}}
        {{/if}}
    {{/foreach}}
{{/if}}

{{include file="public/footer" /}}